<template>
  <div>
    <div class="bounds">
      <div class="header">
        <div>
          <el-button type="text" icon="el-icon-arrow-left" style="color: #F4A780; font-size: 16px" @click="goBack">
            <span>购买加速包</span>
          </el-button>
        </div>
        <div class="right">
          <el-button type="text" icon="el-icon-more"></el-button>
          <el-button type="text" icon="el-icon-s-help"></el-button>
        </div>
      </div>

      <h4>注册</h4>

      <div>
        <el-input v-model="realName" placeholder="请输入真实姓名" clearable style="width: 200px"></el-input><br>
        <el-input v-model="idCard" placeholder="请输入身份证号" clearable style="width: 200px"></el-input><br>
      </div>

      <div class="end"><el-button type="primary" @click="toRegister">绑定</el-button></div>
    </div>
  </div>
</template>

<script>
let url = "http://localhost:9701/web/";
export default {
  data() {
    return {
      tableData: [],
      realName:'',
      idCard:''
    }
  },
  methods:{
    goBack(){
      this.$router.go(-1)
    },
    Js() {
      setTimeout(() => {
        this.$router.push({path: '/accelerate'});
        this.isNavigating = false; // 导航完成后，重置标志位
      }, 500); // 延迟500毫秒跳转
    },
    toRegister(){
      this.axios.get(url+`charge-record/toRegister?idCard=${this.idCard}&realName=${this.realName}`).then(res=>{
        if(res.data.code==200){
          this.$message.success(res.data.data)
          this.Js();
        }else{
          this.$message({
            message: '绑定失败',
            type: 'error'
          });
        }
      })
    }
  }
}
</script>
<style>
.bounds {
  width: 390px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
}

.right {
  display: flex;
  border: 1px solid #F4A780;
  padding: 5px 5px;
  border-radius: 15px;
}

.right button {
  color: #F4A780;
  padding: 0 5px;
  font-size: 18px;
}

.end button {
  margin-top: 30px;
}


</style>